The GO Workshop by Delio D'Anna Andrew Hayes Sam Hennessy Jeremy Leasor Gobin Sougrakpam and Dániel Szabó
Author:Delio D'Anna, Andrew Hayes, Sam Hennessy, Jeremy Leasor,
Gobin Sougrakpam, and Dániel Szabó
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2020-12-28T00:00:00+00:00
Figure 10.3: Transaction deadline not met
When we meet the deadline, it looks like this:
Figure 10.4: Transaction deadline met
Let's dissect our example. First, we define a deadline for the transaction with the time.Duration() variable. In my experience, the Millisecond resolution is optimal; however, it does take some time to get used to calculating it. Feel free to use whichever resolution you prefer. We mark the beginning with the Start variable, do some calculations, and mark the completion with the End variable. The magic happens after this. We would like to calculate the difference between the deadline and the transaction duration, but we cannot do it directly. We need to convert the Duration value to Transaction time. This is done the same way when we created our deadline. We simply use the Nanosecond resolution, which is the lowest resolution we should go to. However, in this case, you can use the resolution you would like. After conversion, we can easily compare and decide whether the transaction is fine or not.
Now, let's see how we can manipulate time.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(22540)
Hello! Python by Anthony Briggs(21721)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(20296)
Dependency Injection in .NET by Mark Seemann(19635)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(19403)
Kotlin in Action by Dmitry Jemerov(19348)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(18840)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(17650)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16968)
Grails in Action by Glen Smith Peter Ledbrook(16798)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(14281)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(12244)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(10947)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10598)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(10069)
Hit Refresh by Satya Nadella(9121)
The Kubernetes Operator Framework Book by Michael Dame(8539)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8365)
Robo-Advisor with Python by Aki Ranin(8307)